<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_2
 * @license    GNU/GPL
*/
 
// No direct access
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.view');
 
/**
 * HTML View class for the JobsWorld Component
 *
 * @package    JobsWorld
 */
 
class JobsViewIndhold extends JView
{
    function display($tpl = null)
    {
		global $mainframe, $option;
       	$model = &$this->getModel();
		$session =& JFactory::getSession();
		//$data = JModel::getInstance( 'Jobs', 'JobsModel');
		//$this->assignRef('data',		$data);
		$user		= JFactory::getUser();
		
		$is_user = false; 
		$is_user_caterer = false; 
		foreach ($user->groups as $key => $value){
			if($value==9) {
				$is_user_caterer = true; 
			}
			if($value==2) {
				$is_user = true; 
			}
		}
		
		
		$orders_new_total = $model->getNewOrdersUser($user->id);
		$this->assignRef( 'orders_new_total',	count($orders_new_total) );
		
		if(JRequest::getVar('see')=='all') { 
			$orders_new	= $orders_new_total;
		} else {
			$orders_new	= $model->getNewOrdersUser($user->id,0,4);
		}
		$point = $model->getUserInfo($user->id)->point;
		$this->assignRef( 'orders_new',	$orders_new );
		
		$this->assignRef( 'model',	$model );
		$this->assignRef( 'point',	$point );
		
		
		
		$orders_old_total = $model->getOldOrdersUser($user->id);
		$this->assignRef( 'orders_old_total',	count($orders_old_total) );
		
		
		if(JRequest::getVar('see')=='all') { 
			$orders_old	= $orders_old_total;
		} else {
			$orders_old	= $model->getOldOrdersUser($user->id,0,4);
		}
		
		$this->assignRef( 'orders_old',	$orders_old );
		
		
		$payments_old = $model->getAllPaymentOrder($user->id);
		
		$this->assignRef( 'payments_old', $payments_old);
		
		
		//$this->assignRef( 'items_total',	$items_total );
		
		/*
		$items		= $this->get('data');
		$total		= $this->get('total');
		$pagination	= &$this->get('pagination');
		
		$mainframe->setUserState($option.'filter_state','P');
		$mainframe->setUserState($option.'filter_order_Dir','DESC');
		
		$this->assignRef( 'items',	$items );
		$this->assignRef( 'total',	$total );
		$this->assignRef( 'pagination',	$pagination );
		$this->assignRef( 'model',	$model );
		*/
		/*
		$rows = $model->getListJobs($model->getState('limitstart'), $model->getState('limit'));
		$this->assignRef( 'rows',	$rows );
		$rows_total = $model->getTotalJobs();
		
		$pagination	= $model->getPagination($rows_total);
		$this->assignRef( 'pagination',	$pagination );
		$this->assignRef( 'model',	$model );
		*/
		
		/*
        $greeting = $model->getGreeting();
        $this->assignRef( 'greeting',	$greeting );
 		*/
        parent::display($tpl);
    }
}
?>